package com.suneee.trades.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.suneee.orm.GenericDao;
import com.suneee.orm.util.WhereClauseBuilder;
import com.suneee.trades.dao.ShoppDetailDao;
import com.suneee.trades.entity.ShoppDetail;

@Repository("shoppDetailDao")
public class ShoppDetailDaoImpl extends GenericDao<ShoppDetail, Integer>implements ShoppDetailDao{

	@Override
	public List<ShoppDetail> batchShoppDetailByShoppId(Integer shoppId) {
		WhereClauseBuilder wcb = new WhereClauseBuilder(" select * from t_shopp_detail where 1=1 ");
		wcb.equals("shopp_id",shoppId);
		return this.executeQuery(wcb.getSql(), wcb.getArgs());
	}

	@Override
	public String getOrderIdsByShopId(Integer shoppId) {
		WhereClauseBuilder wcb = new WhereClauseBuilder("select GROUP_CONCAT(order_id) as tid from t_shopp_detail where 1=1 ");
		wcb.equals("shopp_id",shoppId);
		List<ShoppDetail> list = this.executeQuery(wcb.getSql(), wcb.getArgs());
		ShoppDetail shoppDetail = list.get(0);
		return shoppDetail.getTid();
	}

}
